package com.rin.design_pattern.builder;

import java.util.LinkedList;
import java.util.List;

/**
 * @author RinMi
 * @since 2023/5/26
 */
public class Meal {

    private List<Item> itemList = new LinkedList<>();

    public void addItem(Item item){
        itemList.add(item);
    }

    public Double cost(){
        Double money = 0D;
        for (Item item : itemList){
            money += item.price();
        }
        return money;
    }

    public void showItems(){
        for (Item item : itemList) {
            System.out.print("Item : "+item.name());
            System.out.print(", Packing : "+item.packing().packing());
            System.out.println(", Price : "+item.price());
        }
    }

}
